package com.a3dweijing.wetouch2.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.a3dweijing.wetouch2.Common.listview.CommonListviewAdapter;
import com.a3dweijing.wetouch2.Common.listview.ViewHolderListview;
import com.a3dweijing.wetouch2.R;
import com.a3dweijing.wetouch2.Util.GlideUtil;
import com.a3dweijing.wetouch2.bean.GoodsInfoBean;

import java.math.BigDecimal;
import java.util.List;

/**
 * Created by Administrator on 2018/3/28.
 */

public class BuyAdapter<GoodsInfoBean> extends CommonListviewAdapter
{
    public BuyAdapter(Context context, List list, int layoutId)
    {
        super(context, list, layoutId);
    }
    
    @Override
    public void convert(ViewHolderListview holder, Object o, int i)
    {
        com.a3dweijing.wetouch2.bean.GoodsInfoBean item = (com.a3dweijing.wetouch2.bean.GoodsInfoBean)o;
        ViewHolderListview holder1 = holder;
        ImageView img = holder1.getView(R.id.img);
        GlideUtil.getInstance().showImage(context, item.getS_goods_img_url(), img);
        TextView shoppingName = holder1.getView(R.id.shopping_name);
        TextView moneytv = holder1.getView(R.id.money);
        TextView peisongfangshi = holder1.getView(R.id.peisongfangshi);
        TextView numtv = holder1.getView(R.id.num);
        TextView numTv = holder1.getView(R.id.num_tv);
        TextView allMoney = holder1.getView(R.id.all_money);
        shoppingName.setText(item.getS_goods_name());
        moneytv.setText("￥" + item.getS_price());
        peisongfangshi.setText("配送方式");
        numtv.setText("x 1");
        numTv.setText("一共1件商品");
        BigDecimal money = new BigDecimal(item.getS_price());
        BigDecimal num = new BigDecimal(item.getNumber());
        BigDecimal multiply = money.multiply(num);
        allMoney.setText("合计:" + multiply.toString());
    }
}
